{template 'common/header'}
{template 'public/comhead'}
<ul class="nav nav-tabs">
    <li class="active"><a href="#">平台设置</a></li>
</ul>
{if $operation == 'display'}
<link rel="stylesheet" type="text/css" href="{MODULE_URL}public/web/css/main.css"/>
<div class="main">
    <div class="panel panel-default">
        <div class="panel-body">
		    <div class="alert alert-success">
                温馨提示:</br>
				更多平台化设置方法，请参看微教育商业用户群平台功能商业化运营指南
            </div>
            <div class="row">
                <ul class="nav nav-pills" role="tablist">
                    <li {if ($_GPC['do'] == 'fenzu')}class="active"{/if}>
                        <a href="{php echo $this->createWebUrl('fenzu', array('op' => 'display'))}">分组管理</a>
					</li>	
                    <li {if ($_GPC['do'] == 'manager')}class="active"{/if}>
                        <a href="{php echo $this->createWebUrl('manager', array('op' => 'display'))}">二维码管理</a>
                    </li>
                    <li {if ($_GPC['do'] == 'banners')}class="active"{/if}>
                        <a href="{php echo $this->createWebUrl('banners', array('op' => 'display'))}">平台幻灯片</a>
                    </li>
                    <li {if ($_GPC['do'] == 'comad')}class="active"{/if}>
                        <a href="{php echo $this->createWebUrl('comad', array('op' => 'display'))}">贴片广告</a>
                    </li>	
                    <li {if ($_GPC['do'] == 'comload')}class="active"{/if}>
                        <a href="{php echo $this->createWebUrl('comload', array('op' => 'display'))}">公共加载</a>
                    </li>					
                </ul>
            </div>
            <div class="header">
                <h3>学校分组 列表</h3>
            </div>
            <div class="form-group">
                <a class="btn btn-success btn-sm" href="{php echo $this->createWebUrl('fenzu', array('op' => 'sync'))}"><i class="fa fa-circle-o"></i> 同步微信</a>
                <a class="btn btn-primary btn-sm" href="{php echo $this->createWebUrl('fenzu', array('op' => 'post'))}">创建新分组</a>
                <div class="form-group inline-form" style="display: inline-block;">
                    <form accept-charset="UTF-8" action="./index.php" class="form-inline" id="diandanbao/table_search" method="get" role="form">
                        <div style="margin:0;padding:0;display:inline">
                        <input name="utf8" type="hidden" value="✓"></div>
                        <input type="hidden" name="c" value="site" />
                        <input type="hidden" name="a" value="entry" />
                        <input type="hidden" name="m" value="fm_jiaoyu" />
                        <input type="hidden" name="do" value="fenzu" />
                        <input type="hidden" name="weid" value="{$weid}" />
                        <div class="form-group">
                            <label class="sr-only" for="q_name">名称(分组名)</label>
                            <input class="form-control" id="keyword" name="keyword" placeholder="名称(分组名)" type="search">
                        </div>
                        <input class="btn btn-sm btn-success" name="commit" type="submit" value="搜索">
                    </form>
                </div>				
				<form action="" method="post" class="form-horizontal form" >
					<div class="table-responsive panel-body">
							<table class="table table-hover">
								<thead class="navbar-inner">
									<tr>
									    <th></th>
										<th>分组ID</th>
										<th style="width:300px;">所属学校</th>
										<th>分组名称</th>
										<th>粉丝数量</th>
										<th>创建时间</th>
										<th>二维码状态</th>
										<th style="text-align:right;">编辑/删除</th>
									</tr>
								</thead>
								<tbody id="level-list">
								{loop $fenzulist $item}
									<tr>
									    <td>
										<img src="{if strstr($schoolinfo[$item['schoolid']]['logo'], 'http') || strstr($schoolinfo[$item['schoolid']]['logo'], './source/modules/')}{$schoolinfo[$item['schoolid']]['logo']}{else}{$_W['attachurl']}{$schoolinfo[$item['schoolid']]['logo']}{/if}" onerror="this.src='./resource/images/nopic.jpg';" width="45px;" style="border-radius: 3px;">
										</td>
										<td>
										{if $item['group_id'] == 0}<span class="label label-danger">系统分组</span>
										{else if $item['group_id'] == 1}<span class="label label-danger">系统分组</span>
										{else if $item['group_id'] == 2}<span class="label label-danger">系统分组</span>
										{else}<span class="label label-info">{$item['group_id']}</span>
										{/if}
										</td>
										<td>{$schoolinfo[$item['schoolid']]['title']}</td>
										<td>{$item['name']}</td>
										<td>{$item['count']}</td>
										<td>{php echo (date('Y-m-d h:m',$item['createtime']))}</td>
										<td>{if $item['group_id'] < 4}{else}{if $item['type'] == 0}<span class="label label-danger"><i class="fa fa-times-circle">未生成</span>{else}<span class="label label-success"><i class="fa fa-check-circle">已生成</i></span>{/if}{/if}</td>
										<td style="text-align:right;">{if $item['group_id'] < 4}{else}<a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('fenzu', array('op' => 'post', 'id' => $item['id']))}" title="编辑"><i class="fa fa-pencil"></i></a>&nbsp;&nbsp;<a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('fenzu', array('op' => 'delete', 'group_id' => $item['group_id']))}" onclick="return confirm('确认删除此分组吗？');return false;" title="删除"><i class="fa fa-times"></i></a>{/if}</td>
									</tr>
								{/loop}
								</tbody>
							</table>
							{$pager}
					</div>
				</form>
            </div>
        </div>
    </div>
</div>
{elseif $operation == 'post'}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <input type="hidden" name="weid" value="{$weid}" />
        <input type="hidden" name="id" value="{$_GPC['id']}" />
		<input type="hidden" name="group_id" value="{$reply['group_id']}" />
        <div class="panel panel-default">
		    <div class="alert alert-success">
                温馨提示:</br>
				更多平台化设置方法，请参看微教育商业用户群平台功能商业化运营指南
            </div>		
            <div class="panel-heading">
                创建学校分组
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">分组名称</label>
                    <div class="col-sm-9">
                        <input type="text" name="name" class="form-control" value="{$reply['name']}"  placeholder=""/>
                        <span class="help-block">例如：雅思教育、市一中</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">关联学校</label>
                    <div class="col-sm-9">
                        <select class="form-control" style="margin-right:15px;" name="schoolid" autocomplete="off" class="form-control">
                            {loop $school $row}
                            <option value="{$row['id']}" {if $row['id'] == $reply['schoolid'] || $row['id'] == $schoolid} selected="selected"{/if}>{$row['title']}</option>
                            {/loop}
                        </select>
                    </div>
                </div>
				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">分组描述</label>
                    <div class="col-sm-9">
                        <input type="text" name="group_desc" class="form-control" value="{$reply['group_desc']}"  placeholder=""/>
                        <span class="help-block">选填</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
                    <div class="col-sm-9">
                        <input type="text" name="order" class="form-control" value="{$reply['order']}" />
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
{/if}
{template 'common/footer'}